import React, { Component } from 'react'
import { Button, Typography } from 'antd';
import { connect } from "react-redux"
import {addAction} from "../redux/count_action"
const { Title } = Typography;
const mapState = state => {
    return {
        count: state
    }
}
const mapDispatch = {
    addAction
}

class ExerciseCount extends Component {
    addCount = () => {
        this.props.addAction(1)
    }
    render() {
        return (
            <div>
                <Title level={4}>当前的和为：{this.props.count}</Title>
                <Button type='primary' onClick={this.addCount}>点我加1</Button>
            </div>
        )
    }
}

export default connect(mapState, mapDispatch)(ExerciseCount)
